﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;

namespace IHISCETeim.Web.MachineSys.FTradeModel
{
    public partial class FTradeAgentSlectFXFinance : PageBase
    {
        #region 属性 (查询条件)

        /// <summary>
        /// 排序字段 值为 id
        /// </summary>
        protected override string orderField
        {
            get
            {
                return GetRequestValue<string>("orderField", "FnncLsId");
            }
        }
        /// <summary>
        ///  排序方式 desc或 asc
        /// </summary>
        protected override string orderDirection
        {
            get
            {
                return GetRequestValue<string>("orderDirection", "ASC");
            }
        }
        protected override string SQLSort
        {
            get
            {
                return (" SerialNumber Asc," + (orderField + " " + orderDirection) + " ");
            }
        }

        protected string JingXiaoShang
        {
            get
            {
                return GetRequestValue<string>("JingXiaoShang","");

            }
        }

        protected string JiHao
        {
            get
            {
                return GetRequestValue<string>("JiHao", "");
            }
        }

        protected string showid
        {
            get
            {
                return GetRequestValue<string>("showid", "");
            }
        }
        protected string hiddenid
        {
            get
            {
                return GetRequestValue<string>("hiddenid", "");
            }
        }
        protected string BalanceMoneyid
        {
            get
            {
                return GetRequestValue<string>("BalanceMoneyid", "");
            }
        }
        
        #endregion


        protected void Page_Load(object sender, EventArgs e)
        {
            DataBind();
        }

        protected void DataBind()
        {
            this.rpMenu.DataSource = FXFinanceLeaseController.GetPagination(GetWhereSql(), pageNum, numPerPage, SQLSort, ref TotalCount)[0] ;
            this.rpMenu.DataBind();
        }

        protected string GetWhereSql()
        {
            string wheresql = string.Format(" AliasName='{0}' and LPayStatus=0 and LeaseStatus>=2 ", JingXiaoShang);

            if (!string.IsNullOrEmpty(JiHao))
            {
                string LeaseStatussql =string.Format("SerialNumber like '%{0}%'",JiHao);
                if (string.IsNullOrEmpty(wheresql))
                    wheresql = LeaseStatussql;
                else
                    wheresql += " and " + LeaseStatussql;
            }
           

            

            return wheresql;
        }
    }
}